﻿using University.Workshop.Model.CardGame;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.ObjectModel;

namespace University.Workshop.Tests
{
    
    
    /// <summary>
    ///This is a test class for StatisticsTest and is intended
    ///to contain all StatisticsTest Unit Tests
    ///</summary>
    [TestClass()]
    public class StatisticsTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for GetStatistics
        ///</summary>
        [TestMethod()]
        public void GetStatisticsTest()
        {
            Collection<Card> myCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            Collection<Card> tableCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = Statistics.GetStatistics(myCards, tableCards);
            Assert.AreEqual(expected, actual);            
        }

        [TestMethod()]
        public void GetStatisticsTest1()
        {
            Collection<Card> myCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            Collection<Card> tableCards = new Collection<Card>(); // TODO: Initialize to an appropriate value

            myCards.Add(Statistics.ToCard("Club", "Ace"));
            myCards.Add(Statistics.ToCard("Club", "King"));
            myCards.Add(Statistics.ToCard("Club", "Queen"));

            tableCards.Add(Statistics.ToCard("Club", "Jack"));
            tableCards.Add(Statistics.ToCard("Club", "Ten"));

            int expected = 100; // TODO: Initialize to an appropriate value
            int actual;
            actual = Statistics.GetStatistics(myCards, tableCards);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for GetStatistics
        ///</summary>
        [TestMethod()]
        public void GetStatisticsTest2()
        {
            Collection<Card> myCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            Collection<Card> tableCards = new Collection<Card>(); // TODO: Initialize to an appropriate value

            myCards.Add(Statistics.ToCard("Spade","Ace"));
            myCards.Add(Statistics.ToCard("Spade", "Two"));
            myCards.Add(Statistics.ToCard("Spade", "Three"));

            tableCards.Add(Statistics.ToCard("Spade", "Four"));
            tableCards.Add(Statistics.ToCard("Spade", "Five"));

            int expected = 90; // TODO: Initialize to an appropriate value
            int actual;
            actual = Statistics.GetStatistics(myCards, tableCards);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void GetStatisticsTest3()
        {
            Collection<Card> myCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            Collection<Card> tableCards = new Collection<Card>(); // TODO: Initialize to an appropriate value

            myCards.Add(Statistics.ToCard("Heart", "Nine"));
            myCards.Add(Statistics.ToCard("Spade", "Nine"));
            myCards.Add(Statistics.ToCard("Club", "Nine"));

            tableCards.Add(Statistics.ToCard("Diamond", "Nine"));
            tableCards.Add(Statistics.ToCard("Diamond", "Nine"));

            int expected = 80; // TODO: Initialize to an appropriate value
            int actual;
            actual = Statistics.GetStatistics(myCards, tableCards);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void GetStatisticsTest4()
        {
            Collection<Card> myCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            Collection<Card> tableCards = new Collection<Card>(); // TODO: Initialize to an appropriate value

            myCards.Add(Statistics.ToCard("Diamond", "Six"));
            myCards.Add(Statistics.ToCard("Heart", "Six"));
            myCards.Add(Statistics.ToCard("Club", "Six"));

            tableCards.Add(Statistics.ToCard("Club", "Three"));
            tableCards.Add(Statistics.ToCard("Spade", "Three"));

            int expected = 70; // TODO: Initialize to an appropriate value
            int actual;
            actual = Statistics.GetStatistics(myCards, tableCards);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void GetStatisticsTest5()
        {
            Collection<Card> myCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            Collection<Card> tableCards = new Collection<Card>(); // TODO: Initialize to an appropriate value

            myCards.Add(Statistics.ToCard("Heart", "Two"));
            myCards.Add(Statistics.ToCard("Heart", "Seven"));
            myCards.Add(Statistics.ToCard("Heart", "Jack"));

            tableCards.Add(Statistics.ToCard("Heart", "Ace"));
            tableCards.Add(Statistics.ToCard("Heart", "Four"));

            int expected = 60; // TODO: Initialize to an appropriate value
            int actual;
            actual = Statistics.GetStatistics(myCards, tableCards);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void GetStatisticsTes6()
        {
            Collection<Card> myCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            Collection<Card> tableCards = new Collection<Card>(); // TODO: Initialize to an appropriate value

            myCards.Add(Statistics.ToCard("Diamond", "Three"));
            myCards.Add(Statistics.ToCard("Club", "Four"));
            myCards.Add(Statistics.ToCard("Diamond", "Five"));

            tableCards.Add(Statistics.ToCard("Spade", "Six"));
            tableCards.Add(Statistics.ToCard("Heart", "Seven"));

            int expected = 50; // TODO: Initialize to an appropriate value
            int actual;
            actual = Statistics.GetStatistics(myCards, tableCards);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void GetStatisticsTes7()
        {
            Collection<Card> myCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            Collection<Card> tableCards = new Collection<Card>(); // TODO: Initialize to an appropriate value

            myCards.Add(Statistics.ToCard("Heard", "Eigth"));
            myCards.Add(Statistics.ToCard("Spade", "Eigth"));
            myCards.Add(Statistics.ToCard("Club", "Eigth"));

            tableCards.Add(Statistics.ToCard("Club", "Two"));
            tableCards.Add(Statistics.ToCard("Diamond", "Ten"));

            int expected = 40; // TODO: Initialize to an appropriate value
            int actual;
            actual = Statistics.GetStatistics(myCards, tableCards);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void GetStatisticsTes8()
        {
            Collection<Card> myCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            Collection<Card> tableCards = new Collection<Card>(); // TODO: Initialize to an appropriate value

            myCards.Add(Statistics.ToCard("Diamond", "Queen"));
            myCards.Add(Statistics.ToCard("Spade", "Queen"));
            myCards.Add(Statistics.ToCard("Heard", "Five"));

            tableCards.Add(Statistics.ToCard("Club", "Two"));
            tableCards.Add(Statistics.ToCard("Spade", "Five"));

            int expected = 30; // TODO: Initialize to an appropriate value
            int actual;
            actual = Statistics.GetStatistics(myCards, tableCards);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void GetStatisticsTes9()
        {
            Collection<Card> myCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            Collection<Card> tableCards = new Collection<Card>(); // TODO: Initialize to an appropriate value

            myCards.Add(Statistics.ToCard("Club", "King"));
            myCards.Add(Statistics.ToCard("Diamond", "King"));
            myCards.Add(Statistics.ToCard("Club", "Seven"));

            tableCards.Add(Statistics.ToCard("Spade", "Two"));
            tableCards.Add(Statistics.ToCard("Heard", "Jack"));

            int expected = 20; // TODO: Initialize to an appropriate value
            int actual;
            actual = Statistics.GetStatistics(myCards, tableCards);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void GetStatisticsTes10()
        {
            Collection<Card> myCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            Collection<Card> tableCards = new Collection<Card>(); // TODO: Initialize to an appropriate value

            myCards.Add(Statistics.ToCard("Diamond", "Queen"));
            myCards.Add(Statistics.ToCard("Spade", "Seven"));
            myCards.Add(Statistics.ToCard("Heard", "Five"));

            tableCards.Add(Statistics.ToCard("Club", "Three"));
            tableCards.Add(Statistics.ToCard("Spade", "Ten"));

            int expected = 10; // TODO: Initialize to an appropriate value
            int actual;
            actual = Statistics.GetStatistics(myCards, tableCards);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void GetStatisticsTes11()
        {
            Collection<Card> myCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            Collection<Card> tableCards = new Collection<Card>(); // TODO: Initialize to an appropriate value

            myCards.Add(Statistics.ToCard("Diamond", "Queen"));
            myCards.Add(Statistics.ToCard("Spade", "Seven"));
            myCards.Add(Statistics.ToCard("Heard", "Five"));
            myCards.Add(Statistics.ToCard("Heard", "Two"));

            tableCards.Add(Statistics.ToCard("Club", "Three"));
            tableCards.Add(Statistics.ToCard("Spade", "Ten"));

            int expected = 20; // TODO: Initialize to an appropriate value
            int actual;
            actual = Statistics.GetStatistics(myCards, tableCards);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void GetStatisticsTes12()
        {
            Collection<Card> myCards = new Collection<Card>(); // TODO: Initialize to an appropriate value
            Collection<Card> tableCards = new Collection<Card>(); // TODO: Initialize to an appropriate value

            myCards.Add(Statistics.ToCard("Diamond", "Queen"));
            myCards.Add(Statistics.ToCard("Spade", "Seven"));
            myCards.Add(Statistics.ToCard("Heard", "Five"));
            myCards.Add(Statistics.ToCard("Heard", "Two"));

            tableCards.Add(Statistics.ToCard("Club", "Three"));
            tableCards.Add(Statistics.ToCard("Spade", "Ten"));
            tableCards.Add(Statistics.ToCard("Spade", "Jack"));

            int expected = 30; // TODO: Initialize to an appropriate value
            int actual;
            actual = Statistics.GetStatistics(myCards, tableCards);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for ToCard
        ///</summary>
        [TestMethod()]
        public void ToCardTest()
        {
            string suit = "Club"; // TODO: Initialize to an appropriate value
            string rank = "Ace"; // TODO: Initialize to an appropriate value
            Card expected = Statistics.ToCard("Club", "Ace"); // TODO: Initialize to an appropriate value
            Card actual;
            actual = Statistics.ToCard(suit, rank);
            Assert.AreEqual(expected, actual);            
        }
    }
}
